

/*
 * @(#)ListFormMonitoringAction.java
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */
package com.dcivision.form.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.dcivision.form.bean.FormGroup;
import com.dcivision.form.dao.FormGroupDAObject;
import com.dcivision.framework.ApplicationException;
import com.dcivision.framework.GlobalConstant;
import com.dcivision.framework.SystemFunctionConstant;
import com.dcivision.framework.Utility;
import com.dcivision.framework.web.AbstractListAction;
import com.dcivision.framework.web.AbstractSearchForm;

/**
  ListFormMonitoringAction.java

  This class is for list form Monitoring

    @author          Tony Chen
    @company         DCIVision Limited
    @creation date   16/01/2003
    @version         $Revision: 1.7.26.1 $
*/

public class ListFormMonitoringAction extends AbstractListAction {
  protected String listName = "";
  public ListFormMonitoringAction() {
    super();
    this.setListName("formSubmissionList"); 
    this.setListFunctionName("getNullListByFormMonitor");
  }

  /**
   * getMajorDAOClassName
   *
   * @return  The class name of the major DAObject will be used in this action.
   */
  public String getMajorDAOClassName() {
    return("com.dcivision.form.dao.FormSubmissionDAObject");
  }

  /**
   * getFunctionCode
   *
   * @return  The corresponding system function code of action.
   */
  public String getFunctionCode() {
    return(SystemFunctionConstant.FORM_MONITOR); 
  }

  /**
   * setPageTitle
   * set the extend page title and page path.
   * default page path/title will be created by navmode and functionCode
   */
  public void setPageTitle(HttpServletRequest request, HttpServletResponse response, ActionForm form, ActionMapping mapping, ActionForward actionForward){
    FormGroup formGroup = (FormGroup)request.getAttribute("formGroup");
    if(!Utility.isEmpty(formGroup)){
      String extendTitle = formGroup.getGroupName();
      request.setAttribute(GlobalConstant.EXTEND_PAGE_TITLE, extendTitle);
      request.setAttribute(GlobalConstant.EXTEND_PAGE_TITLE_SHOW_ONLY, new Boolean(true));
    }
  }
  
  public void getListData(ActionMapping mapping, AbstractSearchForm form, HttpServletRequest request, HttpServletResponse response) throws ApplicationException {
    ListFormSubmissionForm listForm = (ListFormSubmissionForm)form;
    FormGroupDAObject formGroupDAO = new FormGroupDAObject(this.getSessionContainer(request),this.getConnection(request));
    FormGroup formGroup = (FormGroup)formGroupDAO.getObjectByID(listForm.getFormGroupID());
    request.setAttribute("formGroup", formGroup);
    super.getListData(mapping, form, request, response);
  }    
}
